Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(connector): [Worldpay] use 4 digit expiry year #6543

Merged
merged 2 commits into from
Nov 19, 2024

Conversation

kashif-m
Copy link
Contributor

@kashif-m kashif-m commented Nov 12, 2024

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

Described in #6316 point # 7

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

Helps in transforming expiry date format into a 4 digit value for card payments for worldpay connector!

How did you test it?

1. Create a payment using 2 digit expiry year

cURL

curl --location 'http://localhost:8080/payments' \
    --header 'Content-Type: application/json' \
    --header 'Accept: application/json' \
    --header 'api-key: dev_vK8vdO0cS4wec9MP0W3K8eR0GfgrVoY0oxuhJrx4rCBJm7wxoH16bOdx9fLKvYSc' \
    --data-raw '{"amount":6500,"currency":"USD","confirm":true,"capture_method":"automatic","capture_on":"2022-09-10T10:11:12Z","customer_id":"cus_L8pJ8g0mnsdHmS0FPqrH_4","email":"[email protected]","name":"John Doe","phone":"999999999","profile_id":"pro_1frLOUlLMVZWSYwOz3En","phone_country_code":"+65","description":"Its my first payment request","authentication_type":"no_three_ds","return_url":"https://hyperswitch.io","setup_future_usage":"on_session","customer_acceptance":{"acceptance_type":"offline","accepted_at":"1963-05-03T04:07:52.723Z","online":{"ip_address":"127.0.0.1","user_agent":"amet irure esse"}},"connector":["worldpay"],"payment_method":"card","payment_method_type":"debit","payment_method_data":{"card":{"card_number":"5555555555554444","card_exp_month":"08","card_exp_year":"25","card_holder_name":"John Doe","card_cvc":"123"}},"billing":{"address":{"line1":"1467","line2":"Harrison Street","line3":"Harrison Street","city":"San Fransico","state":"California","zip":"94122","country":"US","first_name":"John"}},"statement_descriptor_name":"joseph","statement_descriptor_suffix":"JS","metadata":{"udf1":"value1","new_customer":"true","login_date":"2019-09-10T10:11:12Z"},"browser_info":{"ip_address":"129.0.0.1","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","language":"en-US","color_depth":32,"screen_height":1117,"screen_width":1728,"time_zone":-330,"java_enabled":true,"java_script_enabled":true}}'

Response

{"payment_id":"pay_YaS6joNtZ9HBVpj9MeBc","merchant_id":"merchant_1731407657","status":"processing","amount":6500,"net_amount":6500,"shipping_cost":null,"amount_capturable":0,"amount_received":null,"connector":"worldpay","client_secret":"pay_YaS6joNtZ9HBVpj9MeBc_secret_hKl5jcvcPvtajzBOoKFt","created":"2024-11-12T10:53:30.637Z","currency":"USD","customer_id":"cus_L8pJ8g0mnsdHmS0FPqrH_4","customer":{"id":"cus_L8pJ8g0mnsdHmS0FPqrH_4","name":"John Doe","email":"[email protected]","phone":"999999999","phone_country_code":"+65"},"description":"Its my first payment request","refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":"on_session","off_session":null,"capture_on":null,"capture_method":"automatic","payment_method":"card","payment_method_data":{"card":{"last4":"4444","card_type":"CREDIT","card_network":"Mastercard","card_issuer":"MASTERCARD INTERNATIONAL","card_issuing_country":"BRAZIL","card_isin":"555555","card_extended_bin":null,"card_exp_month":"08","card_exp_year":"25","card_holder_name":null,"payment_checks":null,"authentication_data":null},"billing":null},"payment_token":null,"shipping":null,"billing":{"address":{"city":"San Fransico","country":"US","line1":"1467","line2":"Harrison Street","line3":"Harrison Street","zip":"94122","state":"California","first_name":"John","last_name":null},"phone":null,"email":null},"order_details":null,"email":"[email protected]","name":"John Doe","phone":"999999999","return_url":"https://hyperswitch.io/","authentication_type":"no_three_ds","statement_descriptor_name":"joseph","statement_descriptor_suffix":"JS","next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":null,"payment_method_type":"debit","connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"cus_L8pJ8g0mnsdHmS0FPqrH_4","created_at":1731408810,"expires":1731412410,"secret":"epk_e83ffd4da9e542ef90d16ce72cf6ac9c"},"manual_retry_allowed":false,"connector_transaction_id":"eyJrIjoiazNhYjYzMiIsImxpbmtWZXJzaW9uIjoiNS4wLjAifQ==.sN:g8wd64bwkbrp0md+bPxcanBnk2zLdsIqSa1pR99GGg8fCNQpPLoWNslSzWNPFBM5Tpa8tW7EFI5onKINsgChMHeJVoeH2lrBWCRyjZYT6h+lbqfJa+1BSoKFSY8HLge3KVdfHweTSyJ5K44EVLaxYshRzFR5L:3DblLntpx6mfgF9Uk2Www3mSVoKRxeIXIe9pic4l22Rveu3MW0qp:7+4GYJYOg3e9WdLnxDKf8zDOVuNV9Smp3TrKAPuNF+mGHv+EpbUsv07dKPa3jQZMZkSLOAGYpq4tIxEOnFazFMnNixp9xnyekZxhsndH6QYG9PvEiRYH4jvUN3Rj+v30knvWcoLtqA6gq4131NoZaq1HEMk0Or2+rYD5MFugS490qxbGU5BlL+g0uitRgZrQ==","frm_message":null,"metadata":{"udf1":"value1","login_date":"2019-09-10T10:11:12Z","new_customer":"true"},"connector_metadata":null,"feature_metadata":null,"reference_id":"3a722672-4625-45bd-ab45-0393d9be067b","payment_link":null,"profile_id":"pro_1frLOUlLMVZWSYwOz3En","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_4VLjE6cyJN8rQeR7yhYV","incremental_authorization_allowed":null,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2024-11-12T11:08:30.637Z","fingerprint":null,"browser_info":{"language":"en-US","time_zone":-330,"ip_address":"129.0.0.1","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","color_depth":32,"java_enabled":true,"screen_width":1728,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":1117,"java_script_enabled":true},"payment_method_id":null,"payment_method_status":null,"updated":"2024-11-12T10:53:32.161Z","charges":null,"frm_metadata":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":null}

Cypress

Screenshot 2024-11-14 at 9 52 42 AM

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by just clippy && just clippy_v2
  • I reviewed the submitted code
  • I added unit tests for my changes where possible

@kashif-m kashif-m self-assigned this Nov 12, 2024
@kashif-m kashif-m requested a review from a team as a code owner November 12, 2024 10:58
Copy link

semanticdiff-com bot commented Nov 12, 2024

Review changes with  SemanticDiff

Changed Files
File Status
  crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs  0% smaller
  crates/hyperswitch_connectors/src/utils.rs  0% smaller
  cypress-tests/cypress/e2e/PaymentUtils/WorldPay.js  0% smaller

@kashif-m kashif-m linked an issue Nov 12, 2024 that may be closed by this pull request
2 tasks
@Gnanasundari24
Copy link
Contributor

@kashif-m Can you verify same in cypress test by passing 2 digit for worldpay

@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Nov 19, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 19, 2024
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Nov 19, 2024
@@ -26,23 +26,23 @@ const browser_info = {
"ip_address": "127.0.0.1"
};

const successfulNo3DSCardDetails = {
const successfulNoThreeDsCardDetailsRequest = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A quick question: is the name verified with <test>.cy.js?

Merged via the queue into main with commit e730a2e Nov 19, 2024
15 of 17 checks passed
@Gnanasundari24 Gnanasundari24 deleted the worldpay-expiry-date-fix branch November 19, 2024 15:34
AmeyWale-HS pushed a commit to AmeyWale-HS/hyperswitch that referenced this pull request Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[REFACTOR] Worldpay payments integration
4 participants